	import flash.display.Sprite;
	import flash.display.Stage;
	    import flash.text.TextField;
	    import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import flash.events.Event;
	import flash.text.TextFieldAutoSize;
	//import string.Css;
	import flash.text.StyleSheet;
	import flash.events.TextEvent;

	typedef FontColor = {
		var fontWeight		: String;
		var color		: String;
	};

	typedef FontColorDecor = {>FontColor,
		var textDecoration	: String;
	};
	
	class ErrorMsg extends Sprite {
		
		public function new( msg:String ) {
			super();			
			var title:TextField = new TextField();
			title.text = msg;
			
			var fmt:TextFormat = new TextFormat();
			fmt.color = 0x000000;
			fmt.font = "Courier";
			fmt.size = 10;
			fmt.align = flash.text.TextFormatAlign.LEFT; //"left";
		
			title.setTextFormat(fmt);
			title.autoSize = flash.text.TextFieldAutoSize.LEFT; //"left";
			title.border = true;
			title.x = 5;
			title.y = 5;
			
			this.addChild(title);
		}
		
		public function add_html( html:String ): Void {
			
			var txt:TextField = new TextField();
			
			var style:StyleSheet = new StyleSheet();

			var hover:FontColor = 
			{
				fontWeight : "bold"
				, color : "#0000FF"
				//, textDecoration : ""
			};
			
			var link:FontColorDecor =
			{
				fontWeight : "bold"
				, textDecoration : "underline"
				, color : "#0000A0"
			};
			
			var active:FontColor =
			{
				fontWeight : "bold"
				, color : "#0000A0"
				//, textDecoration : ""
			};

			var visited:FontColorDecor = {
				fontWeight : "bold"
				, color : "#CC0099"
				, textDecoration : "underline"
			}

			style.setStyle("a:link", link);
			style.setStyle("a:hover", hover);
			style.setStyle("a:active", active);
			style.setStyle(".visited", visited); //note Flash doesn't support a:visited
			
			txt.styleSheet = style;
			txt.htmlText = html;
			txt.autoSize = flash.text.TextFieldAutoSize.LEFT; //"left";
			txt.border = true;
			
			var t:TextField = cast(this.getChildAt(0),TextField);
			txt.y = t.y + t.height + 10;
			txt.x = 5;
			
			this.addChild( txt );
			
		}
	}
